package com.xckj.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.xckj.dao.JacgClassAnnotationMapper;
import com.xckj.entity.JacgClassAnnotation;
import com.xckj.service.JacgClassAnnotationService;
import com.xckj.utils.ReturnT;

/**
 * @description 类上的注解信息表
 * @author yanchf
 * @date 2023-12-03
 */
@Service
public class JacgClassAnnotationServiceImpl implements JacgClassAnnotationService {

	@Resource
	private JacgClassAnnotationMapper jacgClassAnnotationMapper;


	@Override
	public Object insert(JacgClassAnnotation jacgClassAnnotation) {

		// valid
		if (jacgClassAnnotation == null) {
			return ReturnT.error("必要参数缺失");
        }

		jacgClassAnnotationMapper.insert(jacgClassAnnotation);
        return ReturnT.success();
	}


	@Override
	public Object delete(int id) {
		int ret = jacgClassAnnotationMapper.delete(id);
		return ret>0?ReturnT.success():ReturnT.error();
	}


	@Override
	public Object update(JacgClassAnnotation jacgClassAnnotation) {
		int ret = jacgClassAnnotationMapper.update(jacgClassAnnotation);
		return ret>0?ReturnT.success():ReturnT.error();
	}


	@Override
	public JacgClassAnnotation load(int id) {
		return jacgClassAnnotationMapper.load(id);
	}


	@Override
	public Map<String,Object> pageList(int offset, int pagesize) {

		List<JacgClassAnnotation> pageList = jacgClassAnnotationMapper.pageList(offset, pagesize);
		int totalCount = jacgClassAnnotationMapper.pageListCount(offset, pagesize);

		// result
		Map<String, Object> result = new HashMap<String, Object>();
		result.put("pageList", pageList);
		result.put("totalCount", totalCount);

		return result;
	}

}